﻿/**
 * ...
 * @author LuoDong
 * @eamil luo4521@online.net.tw
 */
package com.addcn.texas.view.components
{	
	import com.addcn.texas.event.UserInfoEvent;
	import flash.display.DisplayObject;
	import flash.display.MovieClip;	
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	import flash.text.TextField;
	
	public class MyInfoBox extends MovieClip 
	{
		public static const CLICK_PHOTO : String = "clickPhoto"
		public static const MOUT_PHOTO : String = "moutPhoto"
		private var _pic : Object;
		
		function MyInfoBox() : void
		{					
			this["UserPhotoBox"].addEventListener(MouseEvent.CLICK, _photoClickHandler);
			this["UserPhotoBox"].buttonMode = true;			
		}
		
		public function setPhoto(r_pic : Object) : void
		{				
			if (!r_pic) return;
			if (this._pic) {			
				if (this._pic.parent) {
					this._pic.parent.removeChild(this._pic);
				}
			}			
			this["UserPhotoBox"].addChild(r_pic as DisplayObject);
			r_pic.x = 4;
			r_pic.y = 4;			
			this._pic = r_pic;
		}
		
		private function _photoClickHandler(evt : Event) : void
		{
			var _event : Event = new Event(MyInfoBox.CLICK_PHOTO);
			dispatchEvent(_event);
		}
		
				
	}
	
}